Skip to content

Conversation

@marybm-dev
Copy link
Contributor

@marybm-dev marybm-dev commented Oct 13, 2025

Details

What: Add an environment variable to disable DisplayLink during testing

Why:

  • Animations during testing were causing crashes
  • Non-invasive to production code
  • Standard pattern in iOS development
  • Easy for any app to adopt
  • No performance impact on production

Related Issue

#339

Motivation and Context

Why is this change required? What problem does it solve?

HorizonCalendar's CalendarView crashes during accessibility testing with the error:

Fatal error: Could not find a corresponding frame for [date]
Location: HorizonCalendar/CalendarView.swift:715 - positionRelativeToVisibleBounds

This crash occurs when CalendarView's DisplayLink (animation timer) fires during test execution, attempting to calculate scroll positions before the view is fully initialized.

How Has This Been Tested

In my local project I have accessibility tests that now do the following which has resolved the crashes 100% of the time.

  open override func setUp() {
    super.setUp()
    setenv("HORIZON_CALENDAR_DISABLE_DISPLAY_LINK", "true", 1)
  }

  open override func tearDown() {
    super.tearDown()
    setenv("HORIZON_CALENDAR_DISABLE_DISPLAY_LINK", "false", 1)
  }

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation. (The change I made in the docs is optional but can be helpful to others)
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@bryankeller bryankeller self-requested a review October 13, 2025 19:29
Copy link
Contributor

@bryankeller bryankeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for investigating, fixing, and documenting it!

@bryankeller bryankeller merged commit 4702347 into airbnb:master Oct 13, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants